#include <cstdio>
int main()
{
    int a[2000][2] = { 0 };
    int count = 0;
    int i;
    int multi;
    while (scanf("%d%d", &a[count][0], &a[count][1]) != EOF)++count;
    count-=1;
    for (i = 0; i < count; ++i)
    {
        multi = a[i][1] * a[i][0];
        a[i][0] = multi;
        --a[i][1];
    }
    if(0==count)
    {//陷阱
        printf("0 0");
    }else{
        for (i = 0; i < count; ++i)
        {
            if (a[i][1] + 1)
            {//指数不为0
                printf("%d %d", a[i][0], a[i][1]);
                if ((i<count-1&&a[i+1][1]+1)||i+1<count-1)
                    putchar(' ');
            }
        }
    }
    return 0;
}
